﻿@using Microsoft.AspNet.Identity

@*@*Quang: 29/06/2015 : fix menuPath*@
@functions{
    public string[] MenuPath(string cmnName)
    {
        string[] MNP = null;
        if (Session["MenuList"] != null)
        {
            //Quang : Test MenuPath Dong
            List<DHQGHN.PM2.Models.MenuModel> listMenu = Session["MenuList"] as List<DHQGHN.PM2.Models.MenuModel>;
            if (cmnName.Equals("Manage")) MNP = new string[] { "Trang chủ", "" };
            else
            {
                foreach (var cp in listMenu.Where(cp => cp.MenuName.Equals(cmnName)))
                {
                    foreach (var mi in listMenu.Where(mi => mi.MenuId == cp.ParentMenuId))
                    {
                        MNP = new string[] { mi.MenuName, cp.MenuName };
                    }
                }
            }
        }
        return MNP;
    }
}
@{
    if (Request.IsAuthenticated)
    {
        string[] MNP = MenuPath(ViewBag.Title);
        if (MNP != null)
        {
            <div id="nav" class="menuPath_nav" >
                @*<div id="nav"><a href="@Url.Content("~/Area/DrawArea)" title="">QUẢN LÝ ĐỊA BÀN</a> >> @ViewBag.Title.ToUpper()</div>*@
                <img src="../Images/home1.png" id="home" align="left"> &nbsp; @MNP[0] >> @MNP[1]
            </div>
        }
        else
        { <div id="nav" class="menuPath_nav">           
            @*<div id="nav">*@>> Home@*</div>*@
        </div>
        }
        @*<div class="menuPath_nav">
        <div id="nav"><a href="@Url.Content("~/Area/DrawArea)" title="">QUẢN LÝ ĐỊA BÀN</a> >> @ViewBag.Title.ToUpper()</div>
    </div>*@

    }
}